<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>每日红包</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
	#ggtable .layui-input{ display:inline;height:30px}
	#ggtable .layui-btn{ margin-top:-3px;margin-left:1px}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header">
					每日红包
					<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
				</div>
				<div class="layui-card-body" pad15>
					<!-- <blockquote class="layui-elem-quote"></blockquote> -->
					<div class="flex">
						<div class="layui-form flex1" lay-filter="" style="padding-bottom:20px">
							<input type="hidden" name="info[id]" value="{$info.id}"/>
							<input type="hidden" name="info[type]" value="{$info.type}"/>

							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px"><span class="redstar">*</span>活动名称：</label>
								<div class="layui-input-inline" style="width:300px">
									<input type="text" class="layui-input" name="info[name]" value="{$info.name}" lay-verify="required" lay-verType="tips"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">顶部图片：</label>
								<input type="hidden" name="info[banner]" id="banner" lay-verType="tips" class="layui-input" value="{$info.banner}">
								<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="banner" upload-preview="bannerPreview" onclick="uploader(this)">上传图片</button>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×320像素，png格式</div>
								<div id="bannerPreview" style="float:left;padding-top:10px;padding-left:160px;clear: both;">
									<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$info.banner}"/></div></div>
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px"><span class="redstar">*</span>活动规则：</label>
								<div class="layui-input-inline" style="width:300px">
									<textarea class="layui-textarea" name="info[guize]" lay-verify="required" lay-verType="tips">{$info.guize}</textarea>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px"><span class="redstar">*</span>开始时间：</label>
								<div class="layui-input-inline">
									<input type="text" id="starttime" name="info[starttime]" value="{:date('Y-m-d H:i:s',$info['starttime'])}" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px"><span class="redstar">*</span>结束时间：</label>
								<div class="layui-input-inline">
									<input type="text" id="endtime" name="info[endtime]" value="{:date('Y-m-d H:i:s',$info['endtime'])}" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px"><span class="redstar">*</span>每日红包个数：</label>
								<div class="layui-input-inline" style="width:300px">
									<input type="text" class="layui-input" name="info[num]" value="{$info.num}" lay-verify="required" lay-verType="tips"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">商品返红包额度比例：</label>
								<div class="layui-input-inline">
									<input type="text" name="info[shop_product_hongbao_bl]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.shop_product_hongbao_bl}">
								</div>
								<div class="layui-form-mid">%</div>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">全局设置商品返红包额度比例，优先级小于单个商品设置</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">买单返红包额度比例：</label>
								<div class="layui-input-inline">
									<input type="text" name="info[maidan_hongbao_bl]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.maidan_hongbao_bl}">
								</div>
								<div class="layui-form-mid">%</div>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">买单返红包额度比例</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">红包池计算基数：</label>
								<div class="" style="">
									<input type="radio" name="info[shop_order_money_type]" value="pay" title="已付款订单" {if $info['shop_order_money_type']=='pay'}checked{/if}/>
									<input type="radio" name="info[shop_order_money_type]" value="receive" title="确认收货订单" {if $info['shop_order_money_type']=='receive'}checked{/if}/>
								</div>
								<div class="layui-form-mid layui-word-aux">已付款订单：昨日已支付状态订单的总金额；确认收货订单：昨日已收货状态订单的总金额</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">商城业绩红包池比例：</label>
								<div class="layui-input-inline">
									<input type="text" name="info[hongbao_bl]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.hongbao_bl}">
								</div>
								<div class="layui-form-mid">%</div>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">平台商城昨日业绩按百分比进入今日红包池</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">多商户业绩红包池比例：</label>
								<div class="layui-input-inline">
									<input type="text" name="info[hongbao_bl_business]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.hongbao_bl_business}">
								</div>
								<div class="layui-form-mid">%</div>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">多商户商城昨日业绩按百分比*费率进入今日红包池</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">买单业绩红包池比例：</label>
								<div class="layui-input-inline">
									<input type="text" name="info[hongbao_bl_maidan]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.hongbao_bl_maidan}">
								</div>
								<div class="layui-form-mid">%</div>
								<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">多商户买单昨日业绩按百分比*费率进入今日红包池</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">提现方式：</label>
								<div class="layui-input-inline" style="width:400px">
									<input type="checkbox" name="info[withdraw]" title="余额" value="1" {if $info['withdraw']==1}checked{/if}/>
									<input type="checkbox" name="info[withdraw_weixin]" title="微信钱包" value="1" {if $info['withdraw_weixin']==1}checked{/if}>
									<input type="checkbox" name="info[withdraw_score]" title="{:t('积分')}" value="1" {if $info['withdraw_score']==1}checked{/if}>
								</div>
								<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:160px">提现到微信钱包需开通企业付款到零钱功能</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px">自动打款：</label>
								<div class="layui-input-inline" style="width:200px">
									<input type="radio" name="info[withdraw_autotransfer]" value="0" title="关闭" {if $info['withdraw_autotransfer']==0}checked{/if}/>
									<input type="radio" name="info[withdraw_autotransfer]" value="1" title="开启" {if $info['withdraw_autotransfer']==1}checked{/if}/>
								</div>
								<div class="layui-form-mid layui-word-aux">开启后提现到微信钱包时不需要审核，自动用企业付款打款，需开通企业付款到零钱功能</div>
							</div>
							<div id="withdrawotherset">
								<div class="layui-form-item">
									<label class="layui-form-label" style="width:130px">提现最小金额：</label>
									<div class="layui-input-inline" style="width:120px">
										<input type="text" name="info[withdrawmin]" value="{$info['withdrawmin']}" class="layui-input"/>
									</div>
									<div class="layui-form-mid">元</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label" style="width:130px">提现手续费：</label>
									<div class="layui-input-inline" style="width:120px">
										<input type="text" name="info[withdrawfee]" value="{$info['withdrawfee']}" class="layui-input"/>
									</div>
									<div class="layui-form-mid">%</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label" style="width:130px">提现到{:t('积分')}转换比例：</label>
									<div class="layui-input-inline" style="width:120px">
										<input type="text" name="info[withdraw_score_bili]" value="{$info['withdraw_score_bili']}" class="layui-input"/>
									</div>
									<div class="layui-form-mid">如设置100，表示1元=100{:t('积分')}，取整（四舍五入）</div>
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px"><span class="redstar">*</span>状 态：</label>
								<div class="layui-input-inline">
									<input type="radio" name="info[status]" value="1" title="开启" {if !$info['id'] || $info['status']==1}checked{/if}/>
									<input type="radio" name="info[status]" value="0" title="关闭" {if $info['id'] && $info['status']==0}checked{/if}/>
								</div>
							</div>


							<div class="layui-form-item">
								<label class="layui-form-label" style="width:130px"></label>
								<div class="layui-input-block">
									<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
								</div>
							</div>
						</div>
						<div>
						</div>
					</div>
				</div>
			</div>
    </div>
  </div>
	{include file="public/js"/}
	<script>
	$("input[name='info[name]']").bind("input change propertychange",function(event){
		$('#name_preview').text($(this).val())
	})
	//日期时间选择器
	layui.laydate.render({ 
		elem: '#starttime',
		type: 'datetime',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#endtime',
		type: 'datetime',
		trigger: 'click'
	});

	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		//console.log(field);return;
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){
			layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	})

	</script>

	{include file="public/copyright"/}
</body>
</html>